<%--
  Created by IntelliJ IDEA.
  User: 刘邓
  Date: 2023-06-03
  Time: 10:58
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        #inner{
            width:440px;
            height:260px;
            margin-left:530px;
            margin-top:50px;
        }
        a{
            text-decoration: none;
        }
        .bt{
            width:240px;
            height:60px;
            line-height: 60px;
            color:blue;
            font-size:25px;
            margin-top:50px;
            background:#333;
            border-radius:50px;
            font-family:KaiTi;
        }
    </style>
</head>
<body>
   <div style="width: 30%;height: 300px;margin: 0 auto;" id="inner" align="center">
       <form action="/register" method="post">
               用户名：<input type="text" name="userName" id="u_id"><br><br>
               密_码：<input type="password" name="password" id="u_pwd"><br><br>
                再次输入密_码：<input type="password" name="repassword" id="u_repwd"><br><br>
               权_限:<select name="status">
           <option value="0" selected>普通用户</option>
           <option value="1">管理员</option>
       </select>
           <button type="submit" class="bt" id="bts"  align="center" style="display: block">立即提交</button>
       </form>
   </div>
</body>
<script>
    let btn1 = document.getElementById("bts");
    btn1.onclick=function () {
        let id_str=document.getElementById("u_id").value;
        if(id_str===null||id_str===""){
            alert("请输入用户名");
            return;
        }
        let pwd_str=document.getElementById("u_pwd").value;
        if(pwd_str===null||pwd_str===""){
            alert("请输入密码");
            return;
        }
        let repwd_str=document.getElementById("u_repwd").value;
        if(repwd_str===null||repwd_str===""){
            alert("请输入第二次密码");
            return;
        }
        if(repwd_str != pwd_str){
            alert("两次输入密码不一致");
            return;
        }
    }
</script>
</html>
